using System;

using octalforty.Brushie.Web.XmlRpc;

namespace octalforty.Syndication.Blogging.MetaWeblog
{
    /// <summary>
    /// Represents a MetaWeblog-compatible Blog Post.
    /// </summary>
    [XmlRpcStructure()]
    public class BlogPost
    {
        #region Private Member Variables
        private string id;
        private string title;
        private string content;
        private DateTime createdOn;
        private DateTime publishedOn;
        private string[] categories;
        #endregion

        #region Public Properties
        /// <summary>
        /// Gets or sets a string which contains the identifier of the <see cref="BlogPost"/>.
        /// </summary>
        [XmlRpcMember("postid")]
        public string ID
        {
            get { return id; }
            set { id = value; }
        }

        /// <summary>
        /// Gets or sets a string which contains the title of the <see cref="BlogPost"/>.
        /// </summary>
        [XmlRpcMember("title")]
        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        /// <summary>
        /// Gets or sets a string which contains the content of the <see cref="BlogPost"/>.
        /// </summary>
        [XmlRpcMember("description")]
        public string Content
        {
            get { return content; }
            set { content = value; }
        }

        /// <summary>
        /// Gets or sets date and time this <see cref="BlogPost"/> was created.
        /// </summary>
        [XmlRpcMember("dateCreated")]
        public DateTime CreatedOn
        {
            get { return createdOn; }
            set { createdOn = value; }
        }

        /// <summary>
        /// Gets or sets date and time this <see cref="BlogPost"/> was published.
        /// </summary>
        [XmlRpcMember("pubDate")]
        public DateTime PublishedOn
        {
            get { return publishedOn; }
            set { publishedOn = value; }
        }

        /// <summary>
        /// Gets or sets an array of strings which represent categories.
        /// </summary>
        [XmlRpcMember("categories")]
        public string[] Categories
        {
            get { return categories; }
            set { categories = value; }
        }
        #endregion

        /// <summary>
        /// Initializes a new instance of <see cref="BlogPost"/> class.
        /// </summary>
        public BlogPost()
        {
        }

        /// <summary>
        /// Initializes a new instance of <see cref="BlogPost"/> class.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="title"></param>
        /// <param name="content"></param>
        /// <param name="publishedOn"></param>
        public BlogPost(string id, string title, string content, DateTime publishedOn)
        {
            this.id = id;
            this.title = title;
            this.content = content;
            this.publishedOn = publishedOn;
        }
    }
}